package model

//CREATE TABLE `s_access_log` (
//`id` bigint NOT NULL AUTO_INCREMENT COMMENT '记录ID',
//`link_id` int DEFAULT NULL COMMENT '链接ID',
//`access_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '访问时间',
//`ip_address` varchar(30) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'ip地址',
//`user_agent` text COLLATE utf8mb4_general_ci COMMENT '用户代理信息',
//`referer` text COLLATE utf8mb4_general_ci COMMENT '来源页面',
//`domain` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '来源域名',
//`request_url` text COLLATE utf8mb4_general_ci COMMENT '完整请求链接',
//`redirect_url` text COLLATE utf8mb4_general_ci COMMENT '跳转目标页面',
//`language` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '语言',
//`country` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '国家',
//`city` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '城市',
//`device_type` varchar(20) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '设备类型',
//`os` varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '操作系统',
//`browser` varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '浏览器',
//`lat` decimal(10,6) DEFAULT NULL COMMENT '纬度',
//`lon` decimal(10,6) DEFAULT NULL COMMENT '经度',
//PRIMARY KEY (`id`)
//) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

type AccessLog struct {
	Id          int64     `json:"id" gorm:"column:id;type:int(11);not null;primaryKey;autoIncrement"`
	LinkId      int       `json:"link_id" gorm:"column:link_id;type:int(11);default:null"`
	AccessTime  LocalTime `json:"access_time" gorm:"column:access_time;type:timestamp"`
	IpAddress   string    `json:"ip_address" gorm:"column:ip_address;type:varchar(30);default:null"`
	UserAgent   string    `json:"user_agent" gorm:"column:user_agent;type:text"`
	Referer     string    `json:"referer" gorm:"column:referer;type:text"`
	Domain      string    `json:"domain" gorm:"column:domain;type:varchar(255);default:null"`
	RequestUrl  string    `json:"request_url" gorm:"column:request_url;type:text"`
	RedirectUrl string    `json:"redirect_url" gorm:"column:redirect_url;type:text"`
	Language    string    `json:"language" gorm:"column:language;type:varchar(50);default:null"`
	Country     string    `json:"country" gorm:"column:country;type:varchar(50);default:null"`
	City        string    `json:"city" gorm:"column:city;type:varchar(50);default:null"`
	DeviceType  string    `json:"device_type" gorm:"column:device_type;type:varchar(20);default:null"`
	Os          string    `json:"os" gorm:"column:os;type:varchar(64);default:null"`
	Browser     string    `json:"browser" gorm:"column:browser;type:varchar(64);default:null"`
	Lat         float64   `json:"lat" gorm:"column:lat;type:decimal(10,6);default:null"`
	Lon         float64   `json:"lon" gorm:"column:lon;type:decimal(10,6);default:null"`
}
